package com.yzh.controller;

import com.yzh.domain.StudentDetail;
import com.yzh.mapper.StudentDetailMapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("/stu")
public class StudentDetailController {

    private StudentDetailMapper studentDetailMapper;

    @Autowired
    public void setStudentDetailMapper(StudentDetailMapper studentDetailMapper) {
        this.studentDetailMapper = studentDetailMapper;
    }

    @GetMapping(value = "/slist/{sid}")
    @ApiOperation("根据id查询个人的信息")
    public String getDetailById(Model model, @PathVariable("sid")int sid){
        StudentDetail student=studentDetailMapper.queryDetailById(sid);
        model.addAttribute("slist",student);
        return "student/Slist";
    }
}
